package com.chisheng.converter;

import lombok.SneakyThrows;
import org.springframework.core.convert.converter.Converter;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author chisheng
 * @since 2021-11-15
 */
public class StringToDateConverter implements Converter<String, Date> {

    @Override
    @SneakyThrows
    public Date convert(String source) {
        return new SimpleDateFormat("yyyy-MM-dd").parse(source);
    }

}
